package zp.weibo.util;

import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.codec.binary.Base64;
import org.apache.commons.httpclient.util.EncodingUtil;

import android.test.AndroidTestCase;
import android.util.Log;

public class Test extends AndroidTestCase {
	
	
	public void testSina(){
		try{
			String link = "http://api.t.sina.com.cn/statuses/friends_timeline.xml?source=3641955521&count=5";
			URL u = new URL(link);
			HttpURLConnection uc = (HttpURLConnection) u.openConnection();
			uc.setRequestProperty("Authorization", "Basic "
					+ EncodingUtil.getAsciiString(Base64.encodeBase64(EncodingUtil
							.getBytes("55342550@qq.com:999897", "uft-8"))));
			uc.setRequestMethod("GET");
			uc.setConnectTimeout(10*1000);
			int rsp = uc.getResponseCode();
		}catch (Exception e) {
			Log.e("wb", e.toString());
		}
		
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 8748174561983056331L;
	
	
	private List<Message> msgs;

	public Test() {
		msgs = new ArrayList<Message>();

		Message msg = new Message();
		msg.setUser("周平");
		msg.setContent("我在上海");

		msgs.add(msg);
	}

	public Message get(int index) {
		return msgs.get(index);
	}
}
